package mySql;

import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.Connection;



public class DBConnection {
	
	private Connection conn=null;
	private Statement st=null;
	private ResultSet rs=null;
	private PreparedStatement prs=null;
	
	private String driverClass;
	private String url;
	private String name;
	private String password;
	
	public  DBConnection(String driverClass,String url,String password,String name)
	{
		this.driverClass=driverClass;
		this.password=password;
		this.url=url;
		this.name=name;
	}
	
	public Connection getConnection()throws SQLException
	{
		try
		{
			Class.forName(driverClass);
		}catch (java.lang.ClassNotFoundException e) {
			System.err.print("ClassNotFoundException: ");
			System.err.println(e.getMessage());
		}
		conn = DriverManager.getConnection(url, name, password);
		return conn;
	}
	
	
}
